import { User } from "screens/project-list/serarch-panel";
import { useEffect } from 'react';
import { clearObject } from 'utils/index';
import { useHttp } from 'utils/http';
import { useAsync } from 'utils/use-async';
export const useUer = (param?: Partial<User>) => {
  const client = useHttp();
  const { run, ...result } = useAsync<User[]>();
  useEffect(() => {
    run(client('users', { data: clearObject(param || {}) }));
    //TODO 依赖项里加上callback会造成无限循环，这个和usecallback以及userMemo有关系
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [param]);
  return result
}